#!/bin/bash

install_cmake(){
  echo "install cmake"
  yum group install "Development Tools" -y

  yum install cmake3 gcc gtk2-devel numpy pkconfig -y
}
install_opencv(){
  echo "install opencv"
  sudo yum isntall wget
  wget https://github.com/opencv/opencv/archive/4.7.0.zip
  unzip 4.7.0.zip
}
make_opencv(){
  echo "make opencv"
  cd opencv-4.7.0 || exit
  mkdir build
  cd build || exit
  cmake3 -D CMAKE_BUILD_TYPE=DEBUG -D CMAKE_INSTALL_PREFIX=/usr/local ..
  make
  make install
  sudo ldconfig
}


# main
main(){
  install_cmake
  install_opencv
  make_opencv
}
main
